package com.a01_2021.thousandstimes.general.service;

import com.a01_2021.thousandstimes.exception.CustomException;
import com.a01_2021.thousandstimes.general.entity.SysUser;
import com.a01_2021.thousandstimes.utils.AjaxResponse;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.extension.service.IService;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.web.multipart.MultipartFile;

import java.io.IOException;
import java.util.HashMap;
import java.util.List;
import java.util.Set;

/**
 * <p>
 *  服务类
 * </p>
 *
 * @author FRQ
 * @since 2021-02-22
 */
public interface SysUserService extends UserDetailsService, IService<SysUser> {
    AjaxResponse insertUser(SysUser sysUser, String instanceId);

    boolean isUser(long userId);

    HashMap<String, Object> setRole(long userId, Set<Long> roleSet) throws CustomException;

    List<SysUser> getUserFromRole(long roleId) throws CustomException;

    SysUser uploadHeadPic(long userId, String instanceId, MultipartFile file) throws CustomException, IOException;

    SysUser getInfo(long userId);

    List<SysUser> getAllUser(int type);

    int getUserCount(int type);

    @DS("master")
    SysUser getByUsernameFromMaster(long username);
}
